package com.ethan.minimalist.mvp.presenter

import com.cxz.kotlin.baselibs.ext.startHttp
import com.cxz.kotlin.baselibs.mvp.BasePresenter
import com.ethan.minimalist.mvp.contract.IWithdrawContract
import com.ethan.minimalist.mvp.model.WithdrawModel

class WithdrawPresenter : BasePresenter<IWithdrawContract.Model, IWithdrawContract.View>(),
    IWithdrawContract.Presenter {

    override fun createModel(): IWithdrawContract.Model? = WithdrawModel()

    override fun createKitPwd() {
        if(mModel == null) {
            mModel = createModel()
        }
        mModel?.createKitPwd()?.startHttp(mModel, mView,onSuccess = {})
    }

    override fun kitMoney(password: String, money: String) {
        if(mModel == null) {
            mModel = createModel()
        }
        mModel?.kitMoney(password,money)?.startHttp(mModel, mView,onSuccess = {
            mView?.withdrawSuccess(it.data)
        })
    }

}
